home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / getservent.z / getservent
Encoding:
Text File  |  2002-10-03  |  9.4 KB  |  199 lines

  1.  
  2.  
  3.  
  4. GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))                                                  GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      getservent, getservent_r, fgetservent, fgetservent_r, getservbyport,
  10.      getservbyport_r, getservbyname, getservbyname_r, setservent, endservent -
  11.      get service entry
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeettttddddbbbb....hhhh>>>>
  15.  
  16.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvveeeennnntttt((((vvvvooooiiiidddd))));;;;
  17.  
  18.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvveeeennnntttt____rrrr((((ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****eeeennnnttttrrrryyyy,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  19.  
  20.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ffffggggeeeettttsssseeeerrrrvvvveeeennnntttt((((FFFFIIIILLLLEEEE ****))));;;;
  21.  
  22.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ffffggggeeeettttsssseeeerrrrvvvveeeennnntttt____rrrr((((FFFFIIIILLLLEEEE ****,,,, ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****eeeennnnttttrrrryyyy,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  23.  
  24.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvvbbbbyyyynnnnaaaammmmeeee((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrroooottttoooo))));;;;
  25.  
  26.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvvbbbbyyyynnnnaaaammmmeeee____rrrr((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrroooottttoooo,,,, ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****eeeennnnttttrrrryyyy,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  27.  
  28.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvvbbbbyyyyppppoooorrrrtttt((((iiiinnnntttt ppppoooorrrrtttt,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrroooottttoooo))));;;;
  29.  
  30.      ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****ggggeeeettttsssseeeerrrrvvvvbbbbyyyyppppoooorrrrtttt____rrrr((((iiiinnnntttt ppppoooorrrrtttt,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrroooottttoooo,,,, ssssttttrrrruuuucccctttt sssseeeerrrrvvvveeeennnntttt ****eeeennnnttttrrrryyyy,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  31.  
  32.      vvvvooooiiiidddd sssseeeettttsssseeeerrrrvvvveeeennnntttt((((iiiinnnntttt ssssttttaaaayyyyooooppppeeeennnn))));;;;
  33.  
  34.      vvvvooooiiiidddd eeeennnnddddsssseeeerrrrvvvveeeennnntttt((((vvvvooooiiiidddd))));;;;
  35.  
  36. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  37.      _g_e_t_s_e_r_v_e_n_t, _g_e_t_s_e_r_v_b_y_n_a_m_e, _g_e_t_s_e_r_v_b_y_p_o_r_t and their reentrant counterparts
  38.      each return a pointer to an object with the following structure
  39.      containing the broken-out fields of a line in the file /_e_t_c/_s_e_r_v_i_c_e_s, or
  40.      some other back-end database.
  41.  
  42.           struct    servent {
  43.                char *s_name;  /* official name of service */
  44.                char **s_aliases;   /* alias list */
  45.                int  s_port;        /* port service resides at */
  46.                char *s_proto; /* protocol to use */
  47.           };
  48.  
  49.      The members of this structure are:
  50.  
  51.      s_name     The official name of the service.
  52.  
  53.      s_aliases  A zero terminated list of alternate names for the service.
  54.  
  55.      s_port     The port number at which the service  resides.   Port  numbers
  56.                 are returned as a 16-bit value in network byte order.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))                                                  GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))
  71.  
  72.  
  73.  
  74.      s_proto    The name of the protocol to use when contacting the service.
  75.  
  76.      _G_e_t_s_e_r_v_e_n_t reads  the  next  line  of  the  file,  opening  the  file  if
  77.      necessary.
  78.  
  79.      _S_e_t_s_e_r_v_e_n_t opens and rewinds the file.  If the _s_t_a_y_o_p_e_n flag is non-zero,
  80.      the  net data base will not be closed after each call to _g_e_t_s_e_r_v_b_y_n_a_m_e or
  81.      _g_e_t_s_e_r_v_b_y_p_o_r_t.
  82.  
  83.      _E_n_d_s_e_r_v_e_n_t closes the file.
  84.  
  85.      _G_e_t_s_e_r_v_b_y_n_a_m_e and _g_e_t_s_e_r_v_b_y_p_o_r_t sequentially search from the beginning of
  86.      the file until a matching protocol name or port number is found, or until
  87.      EOF is encountered.  If a protocol  name  is  also  supplied  (non-NULL),
  88.      searches must also match the protocol.
  89.  
  90.      The routines fgetservent and fgetservent_r return the next entry from the
  91.      supplied stream as a struct servent structure.  The stream must be of the
  92.      same format as the file /_e_t_c/_s_e_r_v_i_c_e_s.
  93.  
  94.      The functions getservent, fgetservent,  getservbyname  and  getservbyport
  95.      all  return  results in static memory which are overwritten on each call.
  96.      Reentrant versions of each of these routines getservent_r, fgetservent_t,
  97.      getservbyname_r  and  getservbyport_r  are  provided to parse the results
  98.      into supplied memory.  They take three extra arguments, a  pointer  to  a
  99.      struct  servent  structure, a pointer to a character buffer, and a length
  100.      for the buffer.
  101.  
  102.      The functions presented in this manual  page  only  parse  files  of  the
  103.      format  given  in  services(4).   Other back-end databases and protocols,
  104.      such as NIS, can be supplied by the nsd(1M) daemon as  specified  in  the
  105.      nsd configuration file /_e_t_c/_n_s_s_w_i_t_c_h._c_o_n_f.
  106.  
  107. NNNNOOOOTTTTEEEE
  108.      The Mips ABI specifies nothing but local files so applications which wish
  109.      to use anything else must compile with libc prior to libnsl in the
  110.      library list.
  111.  
  112.      When nsd is running changes in the local services file may not be noticed
  113.      by getservent() until the enumeration cache file has timed out.
  114.  
  115. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  116.      All functions that return struct servent * will return a null (0) pointer
  117.      in the case of EOF or failure.
  118.  
  119. FFFFIIIILLLLEEEESSSS
  120.      /etc/services /etc/nsswitch.conf /var/ns/cache/services.byname.m
  121.      /var/ns/cache/services.byport.m
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))                                                  GGGGEEEETTTTSSSSEEEERRRRVVVVEEEENNNNTTTT((((3333NNNN))))
  137.  
  138.  
  139.  
  140. SEE ALSO
  141.      nsd(1M), getprotoent(3N), services(4)
  142.  
  143. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  144.      Null pointer (0) returned on EOF or error.
  145.  
  146. BBBBUUUUGGGGSSSS
  147.      Expecting port numbers to fit in a 32-bit quantity is probably naive.
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.